package com.itheima.service.system.impl;

import com.itheima.dao.system.UserDao;
import com.itheima.domain.system.User;
import com.itheima.factory.DaoInstanceFactory;
import com.itheima.service.system.UserService;
import com.itheima.utils.MD5Util;

public class UserServiceImpl implements UserService{
    @Override
    public User login(String username, String password) {
        UserDao mapper = DaoInstanceFactory.getMapper(UserDao.class);
        return mapper.findByEmailAndPwd(username, password);

    }

    @Override
    public User findById(String id) {
        UserDao mapper = DaoInstanceFactory.getMapper(UserDao.class);
        return mapper.findById(id);
    }

    @Override
    public void update(User user) {
        UserDao mapper = DaoInstanceFactory.getMapper(UserDao.class);
        mapper.update(user);
    }

    @Override
    public User forget(String email, String phoneNum) {
        UserDao mapper = DaoInstanceFactory.getMapper(UserDao.class);
        return mapper.findByEmailAndPN(email, phoneNum);
    }

}
